package model.pojo;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

/**
 * 账户实体 - 对应数据库中的账户表
 */
public class Account {
    //账户ID
    private int accountId;
    //关键字
    private String keyword;
    //账号
    private String accountNumber;
    //密码
    private String password;
    //备注
    private String remark;
    //创建时间
    private Timestamp creationTime;
    //上次修改时间
    private Timestamp lastModificationTime;

    public int getAccountId() {
        return accountId;
    }

    public void setAccountId(int accountId) {
        this.accountId = accountId;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    //将创建时间解析为格式化字符串
    public String getCreationTime() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        return simpleDateFormat.format(creationTime);
    }

    public void setCreationTime(Timestamp creationTime) {
        this.creationTime = creationTime;
    }

    //将上次修改时间解析为格式化字符串
    public String getLastModificationTime() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        return simpleDateFormat.format(lastModificationTime);
    }

    public void setLastModificationTime(Timestamp lastModificationTime) {
        this.lastModificationTime = lastModificationTime;
    }

    public void printAccountInfo(){
        System.out.println("+-------------- 账户信息 --------------+");
        System.out.println("    AccountId: " + this.accountId);
        System.out.println("    关键字: " + this.keyword);
        System.out.println("    账号:" + this.accountNumber );
        System.out.println("    密码: " + this.password);
        System.out.println("    备注: " + this.remark);
        System.out.println("+------------------------------------+");
    }

    public void printAccountInfoDetail(){
        System.out.println("+-------------- 账户信息 --------------+");
        System.out.println("    AccountId: " + this.accountId);
        System.out.println("    关键字: " + this.keyword);
        System.out.println("    账号:" + this.accountNumber );
        System.out.println("    密码: " + this.password);
        System.out.println("    备注: " + this.remark);
        System.out.println("    创建时间: " + this.creationTime);
        System.out.println("    上次修改时间: " + this.lastModificationTime);
        System.out.println("+------------------------------------+");

    }



    @Override
    public String toString() {
        return "Account{" +
                "accountId=" + accountId +
                ", keyword='" + keyword + '\'' +
                ", accountNumber='" + accountNumber + '\'' +
                ", password='" + password + '\'' +
                ", remark='" + remark + '\'' +
                ", creationTime=" + creationTime +
                ", lastModificationTime=" + lastModificationTime +
                '}';
    }
}
